﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;

namespace mal.web.Balades.Business.UnitTest.Bootstrap
{
    abstract class BootstrapBase
    {
        #region Fields

		#endregion
			
		#region Construction / Destruction
			
		#endregion
			
		#region enum, struct, class
			
		#endregion
			
		#region Properties
			
		#endregion
			
		#region Methods
        public abstract void Fill();
        public abstract void Clean();

        protected void ExecuteQuery(string query, params object[] args)
        {
            using (SqlConnection connection = new SqlConnection(mal.balades.Business.DataModel.BaladesDataContext.ConnectionString))
            {
                connection.Open();

                try
                {
                    SqlCommand command = new SqlCommand(string.Format(query, args), connection);
                    command.ExecuteNonQuery();
                }
                catch (Exception exp)
                {                    
                    throw new Exception(string.Format("{0} : {1}", this.GetType().Name, exp.Message), exp);
                }
               
            }
        }
		#endregion
			
		#region Events
			
		#endregion			
			
    }
}
